package com.tsxy.mall.controller;

import com.tsxy.mall.entity.UsedBook;
import com.tsxy.mall.service.UsedBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;

@Controller
public class UsedBookController {
    @Autowired
    private UsedBookService usedBookService;

    @GetMapping("/searchUsedBook")
    public String gotoSearchUsedBook(){

        return "/usedBook/usedBook";
    }

    @GetMapping("/usedBook")
    public String gotoUsedBook(Integer id, Model model){
        UsedBook usedBook = usedBookService.getById(id);
        model.addAttribute("usedBook", usedBook);
        return "usedBook/usedBook";
    }
}
